﻿<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>weiy-直播商城安装程序</title>
    <link href="{{ asset("assets/style/install.css") }}" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="{{ asset("assets/style/jquery.js") }}"></script>
    <script type="text/javascript" src="{{ asset("assets/style/jquery.validation.min.js") }}"></script>
    <script type="text/javascript" src="{{ asset("assets/style/jquery.icheck.min.js") }}"></script>
    <script>
        $(document).ready(function () {
            $('input[type="checkbox"]').iCheck({
                checkboxClass: 'icheckbox_flat-green',
                radioClass: 'iradio_flat-green'
            });
        });

        $(function () {
            jQuery.validator.addMethod("lettersonly", function (value, element) {
                return this.optional(element) || /^[^:%,'\*\"\s\<\>\&]+$/i.test(value);
            }, "不得含有特殊字符");
            $("#install_form").validate({
                errorElement: "font",
                rules: {
                    DB_HOST: {required: true},
                    DB_USERNAME: {required: true},
                    DB_DATABASE: {required: true},
                    DB_PORT: {required: true, digits: true},
                    site_name: {required: true},
                    admin: {required: true, lettersonly: true},
                    password: {required: true, minlength: 6},
                    password_confirmation: {required: true, equalTo: '#password'},
                    agree: {required: true},
                    store_name: {required: true},
                    member_name: {required: true},
                    seller_name: {required: true},
                    member_password: {required: true},
                    rmember_password: {required: true, equalTo: '#member_password'},
                    REDIS_HOST: {required: true},
                    REDIS_PORT: {required: true, digits: true},
                }
            });

            jQuery.extend(jQuery.validator.messages, {
                required: "未输入",
                digits: "格式错误",
                lettersonly: "不得含有特殊字符",
                equalTo: "两次密码不一致",
                minlength: "密码至少6位"
            });

            // 点击下一步直接提交
            $('#next').click(function () {
                $('#install_form').submit();
            });

        });
    </script>
</head>
<body>
<div class="header">
    <div class="layout">
        <div class="title">
            <h2>系统安装向导</h2>
        </div>
        <div class="version">版本: 目前最新版</div>
    </div>
</div>
<div class="main">
    <div class="step-box" id="step3">
        <div class="text-nav">
            <h1>Step.2</h1>
            <h2>创建数据库</h2>
            <h5>填写数据库及站点相关信息</h5>
        </div>
        <div class="procedure-nav">
            <div class="schedule-ico"><span class="a"></span><span class="c"></span><span class="d"></span></div>
            <div class="schedule-point-now"><span class="a"></span><span class="c"></span><span class="d"></span></div>
            <div class="schedule-point-bg"><span class="a"></span><span class="c"></span><span class="d"></span></div>
            <div class="schedule-line-now"><em></em></div>
            <div class="schedule-line-bg"></div>
            <div class="schedule-text">
                <span class="a">检查安装环境</span>
                <span class="c">创建数据库</span>
                <span class="d">安装</span>
            </div>
        </div>
    </div>
    @if ($errors->any())
        <div style="margin: 20px 0 20px 80px">
            <ul>
                @foreach ($errors->all() as $error)
                    <li style="color: red; font-size: 20px">{{ $error }}</li>
                @endforeach
            </ul>
        </div>
    @endif
    @if (session('error'))
        <div style="margin: 20px 0 20px 80px">
            <p style="color: red; font-size: 20px">{{ session('error') }}</p>
        </div>
    @endif
    <form action="{{ route('install.store-step2') }}" id="install_form" method="post">
        @csrf
        <input type="hidden" value="submit" name="submitform">
        <input type="hidden" value="" name="install_recover">
        <div class="form-box control-group">
            <fieldset>
                <legend>数据库信息</legend>
                <div>
                    <label>数据库服务器</label>
                    <span>
                    <input type="text" name="DB_HOST" maxlength="60" value="{{ old("DB_HOST", "localhost") }}">
                    </span>
                    <em>数据库服务器地址，一般为localhost</em>
                </div>
                <div>
                    <label>数据库名</label>
                    <span>
                      <input type="text" name="DB_DATABASE" maxlength="50" value="{{ old("DB_DATABASE") }}">
                    </span>
                    <em></em>
                </div>
                <div>
                    <label>数据库用户名</label>
                    <span>
                      <input type="text" name="DB_USERNAME" maxlength="30" value="{{ old("DB_USERNAME") }}">
                    </span>
                    <em></em>
                </div>
                <div>
                    <label>数据库密码</label>
                    <span>
                      <input type="password" name="DB_PASSWORD" maxlength="30" value="{{ old("DB_PASSWORD") }}">
                    </span>
                    <em></em>
                </div>
                <div>
                    <label>数据库端口</label>
                    <span>
                        <input type="text" name="DB_PORT" maxlength="30" value="{{ old("DB_PORT", 3306) }}">
                    </span>
                    <em>数据库默认端口一般为3306</em>
                </div>
                <div>
                    <label>&nbsp;</label>
                    <input name="demo_data" type="checkbox" id="demo_data" value="1" checked>
                    <h4>演示数据，建议默认安装</h4>
                </div>
            </fieldset>
            <fieldset>
                <legend>网站信息</legend>
                <div>
                    <label>站点名称</label>
                        <span>
                           <input name="site_name" value="{{old("site_name")}}" maxlength="100" type="text">
                        </span>
                    <em>输入站点名称，安装后可在平台设置中进行修改</em>
                </div>
                <div>
                    <label>管理员帐号</label>
                    <span>
                        <input name="admin" value="{{ old("admin") }}" maxlength="20" type="text">
                    </span>
                    <em></em>
                </div>
                <div>
                    <label>管理员密码</label>
                    <span>
                        <input name="password" id="password" maxlength="20" value="" type="password">
                    </span>
                    <em>管理员密码不少于6个字符</em>
                </div>
                <div>
                    <label>重复密码</label>
                    <span>
                      <input name="password_confirmation" value="" maxlength="20" type="password">
                    </span> <em>确保两次输入的密码一致</em>
                </div>
            </fieldset>

            <fieldset>
                <legend>redis配置</legend>
                <div>
                    <label>redis服务器</label>
                    <span>
                       <input type="text" name="REDIS_HOST" maxlength="60" value="{{ old("REDIS_HOST", "127.0.0.1") }}">
                    </span>
                    <em>redis服务器地址，可以为127.0.0.1</em>
                </div>
                <div>
                    <label>redis密码</label>
                    <span>
                        <input name="REDIS_PASSWORD" id="REDIS_PASSWORD" maxlength="20" value="{{ old("REDIS_PASSWORD") }}" type="password">
                    </span>
                    <em></em>
                </div>
                <div>
                    <label>redis端口</label>
                    <span>
                        <input type="text" name="REDIS_PORT" maxlength="30" value="{{ old("REDIS_PORT", 6379) }}">
                    </span>
                    <em>redis默认端口一般为6379</em>
                </div>
            </fieldset>
        </div>
        <div class="btn-box">
            <a href="{{ route('install.step1') }}" class="btn btn-primary">上一步</a>
            <a id="next" class="btn btn-primary">安装</a>
        </div>
    </form>
</div>
<div class="footer">
    <h6><a href="" target="_blank"></a></h6>
</div>
</body>
</html>
